<?php

class table_content extends table
{
	public $id = 0;
	public $category_id = 0;
	public $title = '';
	public $meta_keywords = '';
	public $meta_description = '';
	public $summary = '';
	public $body = '';
	public $frontpage = 0;
	public $created_time = 0;
	public $created_by_id = 0;
	public $created_by_name = '';
	public $modified_time = 0;
	public $modified_by_id = 0;
	public $modified_by_name = '';
	public $hits = 0;

	public function __construct()
	{
		parent::__construct( 'bone_content', 'id');
	}
	
	public function load_frontpage()
	{
		return $this->load_by('frontpage', 1);
	}

	public function hit()
	{
		$db = bone::get_db();
		$db->execute('UPDATE `'.$this->table_name.'` SET `hits`=`hits`+1 WHERE `'.$this->table_key.'` = \''.$this->{$this->table_key}.'\'');
	}
}